import { $get, $put, $delete } from '@js/request'
import { EAddressSchema } from '@src/components/schema/address'

export async function getListRequest (caseid: string): Promise<EAddressSchema[]> {
  const res = await $get('/api/commission/deliveraddress', {
    caseid,
    address_type: '电子地址'
  })
  return res.data
}

export async function delRequest (id: string) {
  const res = await $delete(`/api/commission/deliveraddress/${id}`)
  return res.data
}

export async function updateRequest (d: {[k: string]: any}) {
  const id = d.id
  delete d.id
  const res = await $put(`/api/commission/deliveraddress/${id}`, d)
  return res.data
}